package com.hshoesmall.demo.service.lmpl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.hshoesmall.demo.mapper.ShoesOrderShoesMapper;
import com.hshoesmall.demo.model.dto.ShoesOrderShoesDTO;
import com.hshoesmall.demo.model.entity.ShoesOrderShoes;
import com.hshoesmall.demo.service.ShoesOrderShoesService;
import org.springframework.stereotype.Service;



@Service
public class ShoesOrderShoesServiceImpl extends ServiceImpl<ShoesOrderShoesMapper,ShoesOrderShoes> implements ShoesOrderShoesService {
    @Override
    public ShoesOrderShoes addOrderShoes(ShoesOrderShoesDTO dto) {
//        LambdaQueryWrapper<ShoesOrderShoes> wrapper = new LambdaQueryWrapper<>();
        //LambdaQueryWrapper的好处是写实体属性，而不是数据库字段，这样就不用担心数据库字段改了需要修改java中的代码（只需要修改xml文件就行了）
        ShoesOrderShoes addOdersShoes = ShoesOrderShoes.builder()
                .o_oid(dto.getO_oid())
                .o_sid(dto.getO_sid())
                .ossize(dto.getOssize())
                .osstate(dto.getOsstate())
                .osnum(dto.getOsnum())
                .oremarks(dto.getOremarks())
                .osid(0)
                .order_id(0)
                .shoe_id(0)
                .build();
        baseMapper.insert(addOdersShoes);
        return addOdersShoes;
    }
}
